<?php
include("conn/conn.php");
 include("header.php");
if(!$_SESSION[username]){
    echo "<script>window.location.href='orderlogin.php';</script>";
	exit;
  }
$telphone=$_SESSION["telphone"];
$username=$_SESSION["username"];


$sql=mysql_query("select * from tb_user where tel=".$telphone,$conn);
$user=mysql_fetch_array($sql);

if(!$user){
	  echo "<script>alert('暂无该顾客信息!');window.location.href='index.php';</script>";
	  exit;
}

if(isset($_POST)&$_POST['update']){
	$dingdanhao=date("Ymdhis");
	$spc=$_SESSION[producelist];
	$slc=$_SESSION[quatity];

	$shouhuoren=$user['truename'];
	$xiadanren=$user['truename'];
	$sex=$user['xingbie'];
	$dizhi=$user['city'].' '.$user['area'].' '.$user['dizhi'];
	$tel=$user['tel'];
	$total=$_SESSION['total'];
	mysql_query(
		"insert into tb_dingdan (dingdanhao,spc,slc,shouhuoren,sex,dizhi,tel,xiadanren,total) 
		values ('$dingdanhao','$spc','$slc','$shouhuoren','$sex','$dizhi','$tel','$xiadanren','$total')
	",$conn);	
	$_SESSION['producelist']="";
	$_SESSION['quatity']="";
	$_SESSION['total']="";
	  echo "<script>window.location.href='suc.php';</script>";
	  exit;
}
?>


<div id="content">
<div style="position: fixed; left: 1213px; top: 100px;" id="chatContent">
	<div id="chatOnline">
		<div looyu_bound="1" style="cursor: pointer;" id="chatOn_support"></div>
		<div id="chatOn_close"></div>
	</div>
	<div id="chatOffline">
		<div id="chatOfflineBtn">
			<div id="chatOff_support"></div>
			<div id="chatOff_close"></div>
		</div>
		<div id="chatOfflineTip"></div>
	</div>
</div>
<div class="login_content">
	<form id="pay_form" action="pay.php" method="post" >
				<div class="login_content_top"></div>
				<div class="login_content_main">
					<div class=" submit_order">
						<div class="submit_order_title">
							<img src="kfc_files/step_3.gif" usemap="#Map" border="0">
							<map name="Map" id="Map">
								<area shape="rect" coords="12,3,323,29" class="step1" href="###">
								<area shape="rect" coords="352,3,660,29" class="step2" href="###">
							</map>
						</div>
						<div class="submit_order_main">
							<div class="submit_order_main_info">
								<div class="address_info">
									<span class="info_span_2">送餐信息</span>
									<p>
										<span class="info_span_1">顾客姓名：</span><?php echo $user['truename']; ?></p>
									<p>
										<span class="info_span_1">送餐地址：</span><?php echo $user['city'].' '.$user['area'].' '.$user['dizhi'];?></p>
									<input id="dizhi" type="hidden" name="dizhi" value="<?php echo $user['city'].' '.$user['area'].' '.$user['dizhi'];?>" />
									<input type="hidden" name="update" value="1" />
								</div>

								<div class="clear"></div>
								<div class="info_span_2" style="padding:10px 0 0;">联系信息</div>
								<div style="height: 35px; line-height: 24px; position: relative; margin-top: 10px;">
									<span class="info_span_1">联系电话：</span><?php echo $user['tel']; ?>
								</div>
							</div>

							<div class="total_price">
								<span class="time_span_2">应付总价：<?php echo $_SESSION['total']; ?>元</span>

								
							</div>

						</div>
						<div class="clear"></div>
						<p class="al_c mt35px">
							<input id="back_menu_btn" class="backbtn" type="button">
							<input id="pay_submit_btn" class="subBtn" type="button">
						</p>
						<div class="submit_notes">
							<p class="ft_b">友情提示：</p>
							<p>
								点击"提交"后，您的订单会立即下到我们的餐厅开始制作食品，因此<span class="submit_notes_span">我们将无法接受修改或取消订单</span>&nbsp;，请提交前仔细核对订单内容。</p>
						</div>
						<div class="clear"></div>
					</div>
				</div>
				<div class="login_content_btm"></div>
		</form>
	</div>
</div>
	
<script type="text/javascript">

$(function(){

	$('#back_menu_btn').click(function(){
		window.location="shopping.php";
	});
	$('#pay_submit_btn').click(function(){

		$("#pay_form").submit();
	});
});


</script>



<?php include("footer.php");?>